export interface ToastOptions extends UniApp.ShowToastOptions {
}

export function showToast(options: UniApp.ShowToastOptions) {
  uni.showToast(options)
}

export const Toast = {
  success: (title: string, options?: ToastOptions) => showToast({ title, icon: 'success', ...options }),
  error: (title: string, options?: ToastOptions) => showToast({ title, icon: 'error', ...options }),
  warning: (title: string, options?: ToastOptions) => showToast({ title, icon: 'fail', ...options }),
  info: (title: string, options?: ToastOptions) => showToast({ title, icon: 'none', ...options }),
  loading: (title: string, options?: UniApp.ShowLoadingOptions) => uni.showLoading({ title, mask: true, ...options }),
  hide: () => uni.hideLoading(),
}
